// I don't understand why it doesn't compile in my computer with the given compiler.
// There is some strange messages
// Are there really some mistakes in my syntax?

object PGDC {
def main() : Unit = {
println(new PlusGrandDivCom().computePGDC(54, 81));
}
}

class PlusGrandDivCom {
def computePGDC(num1: Int, num2: Int) : Int = {
	var pgdc: Int;
	var diff: Int;

	if (num1 == num2) {
		pgdc = num1; 
	} else {
		if(num1 < num2) {
			diff = ( num2 - num1);
		} else {
			diff = (num1 - num2);
		}

		pgdc = diff;

		while (!(diff == 0)) {
			if (num1 < num2) {
				diff = (num2 - num1);
				num2 = diff;
			} else {
				diff = (num1 - num2);
				num1 = diff;
			}

			if (!(diff == 0)) {
				pgdc = diff;
			}
		}
	}
	return pgdc;
}
}
